package com.bm.specialvehiclefordispatcher.logics;

import android.content.Context;

import com.bm.corelibs.logic.BaseLogic.NListener;
import com.bm.corelibs.utils.Tools;
import com.bm.specialvehiclefordispatcher.bean.BaseData;
import com.bm.specialvehiclefordispatcher.constants.Constant;
import com.bm.specialvehiclefordispatcher.constants.Urls;

public class SettingManager extends BaseManager {
	public void getHotLine(NListener<BaseData> l) {
		logic.edit().resetAll().setUrl(Urls.GET_HOT_LINE).setListener(l).setBaseClass(BaseData.class);
		logic.doPost();
	}
	
	public void getSinglePage(String type, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("typeName", type + "").setUrl(Urls.GET_SINGLE_PAGE).setListener(l).setBaseClass(BaseData.class);
		logic.doPost();
	}
	
	public void advise(String content,String diapatcherId, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("type", "0").addParam("content", content).addParam("diapatcherId", diapatcherId).setUrl(Urls.ADVISE).setListener(l).setBaseClass(BaseData.class);
		logic.doPost();
	}
	
	public void alterName(String id, String name, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("id", id).addParam("name", name).addParam("role", Constant.ROLE).setUrl(Urls.ALTER_NAME).setListener(l).setBaseClass(BaseData.class);
		logic.doPost();
	}
	
	public void alterPhone(String id, String oldMobile, String mobile, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("id", id).addParam("oldMobile", oldMobile).addParam("mobile", mobile).addParam("role", Constant.ROLE).setUrl(Urls.ALTER_PHONE).setListener(l).setBaseClass(BaseData.class);
		logic.doPost();
	}
	
	public void alterAddress(String id, int areaId, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("id", id).addParam("areaId", areaId + "").addParam("role", Constant.ROLE).setUrl(Urls.ALTER_ADDRESS).setListener(l).setBaseClass(BaseData.class);
		logic.doPost();
	}
	
	public void alterIcon(String id, String icon, NListener<BaseData> l) {
		logic.edit().resetAll().addParam("id", id).addParam("icon", icon).addParam("role", Constant.ROLE).setUrl(Urls.ALTER_ICON).setListener(l).setBaseClass(BaseData.class);
		logic.doPost();
	}
	
	public void logOff(String Id,NListener<BaseData> listener){
		logic.edit().resetAll().addParam("Id", Id).addParam("role", Constant.ROLE).setBaseClass(BaseData.class).setListener(listener).setUrl(Urls.LOG_OFF);
		logic.doPost();
	}
	
	public void upDataVersion(Context context, NListener<BaseData> listener) {
		logic.edit().resetAll().addParam("type", Constant.ROLE)
				.addParam("versionCode", Tools.getVerCode(context) + "")
				.setBaseClass(BaseData.class).setListener(listener)
				.setUrl(Urls.UPDATE_VERSION);
		logic.doPost();
	}
	

}
